export PATH=$HOME/.local/bin:$PATH  # 手动导入xmake的可执行文件路径
export XMAKE_COLORTERM=nocolor  # xmake构建时不再显示彩色字体
root_dir=`pwd`
mkdir build
cd build

echo -e "=======================xmake build info======================="
cd $root_dir
xmake
echo -e "========================== info end ==========================\n\n"


echo -e "=======================cmake build info======================="
cd $root_dir/build
cmake -DUNIT_TEST=1 -DCOMPILE_LIST=true -DCMAKE_BUILD_TYPE=Release ..
make
echo -e "========================== info end ==========================\n\n"


echo -e "============start memory check and interface test============="
cd $root_dir/build
valgrind --leak-check=full ./test/interface_test
echo -e "============ end memory check and interfacc test =============\n\n"



echo -e "================== start code static check ==================="
cd $root_dir
cppcheck ./src ./demos ./test
echo -e "==================== end code static check ===================\n\n"

echo -e "================== start document generate ==================="
cd $root_dir
cd doxygen
./doxygen.sh
echo -e "==================== end document generate ===================\n\n"

echo -e "==========================start pack=========================="
cd $root_dir
rm -rf /tmp/upload /tmp/upload.tar.gz
mkdir /tmp/upload
mkdir /tmp/upload/lib
mkdir /tmp/upload/include
mkdir /tmp/upload/document
cp build/src/libcommon.so /tmp/upload/lib
cp include/*.h /tmp/upload/include
cp doxygen/latex/refman.pdf  /tmp/upload/document/docs.pdf
cd /tmp/
tar -zcvf upload.tar.gz upload
echo -e "========================== pack end ==========================\n\n"

